<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title>摄影作品管理系统</title>
    <script>
      // Global error handler to detect and log errors
      window.addEventListener('error', function(event) {
        console.error('Global error event:', event.error || event.message);
      });

      // Capture and log rejected promises
      window.addEventListener('unhandledrejection', function(event) {
        console.error('Unhandled Promise Rejection:', event.reason);
      });

      // Track original console methods
      const originalConsoleError = console.error;
      console.error = function(...args) {
        // Call original method
        originalConsoleError.apply(console, args);
        
        // Log to a debugging div if needed
        try {
          if (!window.errorLog) {
            window.errorLog = [];
          }
          window.errorLog.push({
            type: 'error',
            time: new Date().toISOString(),
            message: args.map(a => String(a)).join(' ')
          });
          
          // Keep only last 100 errors
          if (window.errorLog.length > 100) {
            window.errorLog.shift();
          }
        } catch (e) {
          // Ignore errors in the error handler
        }
      };
    </script>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
</html> 